﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<TvGuide.UI.Models.ProgramData>" %>

<div class="Category_Widget_Main">
<% foreach (var catlist in Model.Catlist)
   {   
%>

 <div class="Category_Widget_CatContainer"><input type="checkbox" name="<%: catlist.color  %>" value="<%: "Category_"+ catlist.CatId %>" onclick="ProgCatchange(this)" class="ProgCatCheckbox" /> <%: catlist.CatName %></div>

<%
   }
%>

</div>

<script type="text/javascript">

    function ProgCatchange(obj) {
        var allprogs = document.getElementsByClassName('progcathiden');

        for (var ind = 0; ind < allprogs.length; ind++) {
            if (allprogs[ind].value == obj.value) {


                if (obj.checked == true) {
                    var ch1 = document.getElementsByClassName(obj.value);
                    for (var ind = 0; ind < ch1.length; ind++)

                        ch1[ind].style.background = obj.name;
                }
                if (obj.checked == false) {
                    var ch1 = document.getElementsByClassName(obj.value);
                    for (var ind = 0; ind < ch1.length; ind++)

                        ch1[ind].style.background = "";
                }
            }
            break;
        }
        
    }
	

</script>